var getlocation = false;
var _Longitude = '';
var _Latitude = '';
var search ;
var token = localStorage.getItem("token");	

function getgroups(groupIds){
	console.log(groupIds)
	hui.ajax({
	    type : 'POST',
	    url : globleobj['domain']+'/comhospital/getgroups',
	    data : {'group_ids':'5af566d19d2c28de846f22a3,5af566d19d2c28de846f22a7'},
	    beforeSend : function(){hui.loading();},
	    complete   : function(){hui.closeLoading();},
	    success : function(msg){
	    	console.log('getgroups:'+msg)
	    	var data = JSON.parse(msg)
	    	if(data.rc != 0){
	    		hui.toast(data.msg);
	    		return false; 
	    	}
	    	var options = ''; 
	    	for(var i= 0;i< data.list.length; i++){
	    		options += '<li  onclick="teamDetails('+JSON.stringify(data.list[i]).replace(/"/g, "&quot;")+')">'
								+'<a href="javascript:void(0)">'
									+'<div class="hui-media-list-img">'
										+'<img src="../../img/3.jpg" />'
									+'</div>'
									+'<div class="hui-media-content">'
										+'<h1>'+data.list[i].captain.name+'</h1>'
										+'<p>'+data.list[i].captain.specialty+'</p>'
									+'</div>'
								+'</a>'
							+'</li>'
	    	}
	    	$('#allsign').append(options);
	    	
	    },
	    error : function(e){
	        console.log(JSON.stringify(e));
	        hui.iconToast('读取消息失败', 'warn');
	    } 
	}); 
}

function teamDetails(captain){
//	console.log(JSON.stringify(captain))
	var captain = JSON.stringify(captain);
	localStorage.setItem("captain",captain);
	hui.open('teamDetails.html?name=1',{},true);
}

hui.ready(function(){
	getgroups();
	hui('#hui-back').click(function(){
	    //hui.toast('返回');
	});
		
	//跳转社区筛选
	hui('#goCommunitycity').click(function(){
	    hui.open('communitycity.html',{},true);
	});
	
	//跳转团队详情
//	hui('.teamDetails').click(function(){
//	    hui.open('teamDetails.html');
//	});
	
    hui.plusReady(function(){
      	//console.log('plusReady');
    	
    });
});